bitkeeper revision 1.1261.1.1 (424338b72O4irc499IhwoNUikHMy5Q)
authormafetter@fleming.research <mafetter@fleming.research>
Thu, 24 Mar 2005 22:01:27 +0000 (22:01 +0000)
committermafetter@fleming.research <mafetter@fleming.research>
Thu, 24 Mar 2005 22:01:27 +0000 (22:01 +0000)
Minor cleanups, in preparation for merging with mainline.
Removal of some debug hooks.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
xen/arch/x86/domain.c
xen/arch/x86/domain_build.c
xen/arch/x86/mm.c
xen/arch/x86/shadow.c
xen/arch/x86/x86_32/asm-offsets.c
xen/arch/x86/x86_32/domain_page.c
xen/common/page_alloc.c
xen/include/asm-x86/mm.h
xen/include/asm-x86/shadow.h
xen/include/asm-x86/x86_32/domain_page.h

index 8a88488ebe5e611d0604a8f9a0620ffde0411f05..03bc222ec27842b39738c2bcfc8078e6f0899ffa 100644 (file)
@@ -238,7 +238,7 @@ void arch_do_createdomain(struct exec_domain *ed)
         d->shared_info = (void *)alloc_xenheap_page();
         memset(d->shared_info, 0, PAGE_SIZE);
         ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
-        SHARE_PFN_WITH_DOMAIN2(virt_to_page(d->shared_info), d);
+        SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
         machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
                                PAGE_SHIFT] = INVALID_M2P_ENTRY;
 
@@ -262,7 +262,7 @@ void arch_do_createdomain(struct exec_domain *ed)
             mk_l3_pgentry(__pa(d->arch.mm_perdomain_l2) | __PAGE_HYPERVISOR);
 #endif
 
-        shadow_lock_init(d);
+        shadow_lock_init(d);        
         INIT_LIST_HEAD(&d->arch.free_shadow_frames);
     }
 }
index 52fcfe7760857be66f14acf36392412c207ee3fd..53514d14645fec64bf53663fa730ce4e972d5a99 100644 (file)
@@ -426,7 +426,7 @@ int construct_dom0(struct domain *d,
         d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
     d->shared_info->n_vcpu = smp_num_cpus;
 
-    /* setup monitor table */
+    /* Set up monitor table */
     update_pagetables(ed);
 
     /* Install the new page tables. */
@@ -472,12 +472,10 @@ int construct_dom0(struct domain *d,
     for ( pfn = 0; pfn < d->tot_pages; pfn++ )
     {
         mfn = pfn + (alloc_start>>PAGE_SHIFT);
-#if 0
 #ifndef NDEBUG
 #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
-        if ( pfn > REVERSE_START )
+        if ( !opt_dom0_translate && (pfn > REVERSE_START) )
             mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START);
-#endif
 #endif
         ((u32 *)vphysmap_start)[pfn] = mfn;
         machine_to_phys_mapping[mfn] = pfn;
index d2ec59336bff83ef86966fe9da90c40c22bbe235..55af653c0f6ac3f2096b3aa39cb19a3c94f97cf3 100644 (file)
@@ -1088,7 +1088,7 @@ void free_page_type(struct pfn_info *page, unsigned int type)
 }
 
 
-void _put_page_type(struct pfn_info *page)
+void put_page_type(struct pfn_info *page)
 {
     u32 nx, x, y = page->u.inuse.type_info;
 
@@ -1143,7 +1143,7 @@ void _put_page_type(struct pfn_info *page)
 }
 
 
-int _get_page_type(struct pfn_info *page, u32 type)
+int get_page_type(struct pfn_info *page, u32 type)
 {
     u32 nx, x, y = page->u.inuse.type_info;
 
@@ -1880,7 +1880,7 @@ int do_mmu_update(
 
         case MMU_MACHPHYS_UPDATE:
 
-            // HACK ALERT...  This about this later...
+            // HACK ALERT...  Need to think about this some more...
             //
             if ( unlikely(shadow_mode_translate(FOREIGNDOM) && IS_PRIV(d)) )
             {
index 900dd910dfb77941a83b8bf33a5adb90821b369d..435afa45b0f3fa52ebed1ef9821a2ed4c333df2f 100644 (file)
@@ -2,6 +2,7 @@
  * arch/x86/shadow.c
  * 
  * Copyright (c) 2005 Michael A Fetterman
+ * Based on an earlier implementation by Ian Pratt et al
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -658,11 +659,6 @@ set_p2m_entry(struct domain *d, unsigned long pfn, unsigned long mfn)
 
     ASSERT( phystab );
 
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-    int old_map_domain_mem_noisy = map_domain_mem_noisy;
-    map_domain_mem_noisy = 0;
-#endif
-
     l2 = map_domain_mem(phystab);
     if ( !l2_pgentry_val(l2e = l2[l2_table_offset(va)]) )
     {
@@ -685,10 +681,6 @@ set_p2m_entry(struct domain *d, unsigned long pfn, unsigned long mfn)
                                             __PAGE_HYPERVISOR);
     unmap_domain_mem(l1);
 
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-    map_domain_mem_noisy = old_map_domain_mem_noisy;
-#endif
-
     return 1;
 }
 
@@ -722,6 +714,21 @@ alloc_p2m_table(struct domain *d)
         list_ent = page->list.next;
     }
 
+    list_ent = d->xenpage_list.next;
+    while ( list_ent != &d->xenpage_list )
+    {
+        page = list_entry(list_ent, struct pfn_info, list);
+        mfn = page_to_pfn(page);
+        pfn = machine_to_phys_mapping[mfn];
+        if ( (pfn != INVALID_M2P_ENTRY) &&
+             (pfn < (1u<<20)) )
+        {
+            set_p2m_entry(d, pfn, mfn);
+        }
+
+        list_ent = page->list.next;
+    }
+
     return 1;
 }
 
index e2f8f6cfb73a614662b074e1e130b5c1b26df900..1733fb1240e05bff12599656d60233953f32a47a 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <xen/config.h>
 #include <xen/sched.h>
-#include <xen/config.h>
 
 #define DEFINE(_sym, _val) \
     __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
@@ -76,9 +75,4 @@ void __dummy__(void)
     BLANK();
 
     DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
-
-#if PERF_COUNTERS
-    OFFSET(PERFC_hypercalls, struct perfcounter, hypercalls);
-    OFFSET(PERFC_exceptions, struct perfcounter, exceptions);
-#endif
 }
index b0eab61730cb99abb0083f5e57436b76a3610f47..2feeaebb3d9ce05fb5ae80de129e67bfeabb1af5 100644 (file)
@@ -26,11 +26,6 @@ static spinlock_t map_lock = SPIN_LOCK_UNLOCKED;
 /* Use a spare PTE bit to mark entries ready for recycling. */
 #define READY_FOR_TLB_FLUSH (1<<10)
 
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-int map_domain_mem_noisy = 1;
-#endif
-
-
 static void flush_all_ready_maps(void)
 {
     unsigned long *cache = mapcache;
@@ -43,7 +38,8 @@ static void flush_all_ready_maps(void)
     while ( ((unsigned long)(++cache) & ~PAGE_MASK) != 0 );
 }
 
-void *_map_domain_mem(unsigned long pa)
+
+void *map_domain_mem(unsigned long pa)
 {
     unsigned long va;
     unsigned int idx, cpu = smp_processor_id();
index 097008b9f3650ced7f4657703f3dbb32af756b3a..46536bae181fa2e28ac5c365d1397cc2f9fead30 100644 (file)
@@ -350,11 +350,6 @@ void scrub_heap_pages(void)
 
     printk("Scrubbing Free RAM: ");
 
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-    int old_map_domain_mem_noisy = map_domain_mem_noisy;
-    map_domain_mem_noisy = 0;
-#endif
-
     for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ )
     {
         /* Every 100MB, print a progress dot and appease the watchdog. */
@@ -381,10 +376,6 @@ void scrub_heap_pages(void)
         spin_unlock_irqrestore(&heap_lock, flags);
     }
 
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-    map_domain_mem_noisy = old_map_domain_mem_noisy;
-#endif
-
     printk("done.\n");
 }
 
@@ -599,7 +590,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order)
                        pg[i].count_info, pg[i].u.inuse.type_info);
             }
 
-            ASSERT( (pg[i].u.inuse.type_info & PGT_count_mask) == 0 );
+            ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
             pg[i].tlbflush_timestamp  = tlbflush_current_time();
             pg[i].u.free.cpu_mask     = cpu_mask;
             list_del(&pg[i].list);
index 8ddee7e25473eee796a874d85bd10e75836bda52..1c9796df3716edf122b0075fb687585ccb976b96 100644 (file)
@@ -148,21 +148,6 @@ static inline u32 pickle_domptr(struct domain *domain)
         list_add_tail(&(_pfn)->list, &(_dom)->xenpage_list);                \
         spin_unlock(&(_dom)->page_alloc_lock);                              \
     } while ( 0 )
-#define SHARE_PFN_WITH_DOMAIN2(_pfn, _dom)                                  \
-    do {                                                                    \
-        page_set_owner((_pfn), (_dom));                                     \
-        /* The incremented type count is intended to pin to 'writable'. */  \
-        (_pfn)->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;  \
-        wmb(); /* install valid domain ptr before updating refcnt. */       \
-        spin_lock(&(_dom)->page_alloc_lock);                                \
-        /* _dom holds an allocation reference + writable ref */             \
-        ASSERT((_pfn)->count_info == 0);                                    \
-        (_pfn)->count_info |= PGC_allocated | 2;                            \
-        if ( unlikely((_dom)->xenheap_pages++ == 0) )                       \
-            get_knownalive_domain(_dom);                                    \
-        list_add_tail(&(_pfn)->list, &(_dom)->page_list);                   \
-        spin_unlock(&(_dom)->page_alloc_lock);                              \
-    } while ( 0 )
 
 extern struct pfn_info *frame_table;
 extern unsigned long frame_table_size;
@@ -225,36 +210,8 @@ static inline int get_page(struct pfn_info *page,
     return 1;
 }
 
-//#define MFN1_TO_WATCH 0x1d8
-#ifdef MFN1_TO_WATCH
-#define get_page_type(__p, __t) (                                             \
-{                                                                             \
-    struct pfn_info *_p = (__p);                                              \
-    u32 _t = (__t);                                                           \
-    if ( page_to_pfn(_p) == MFN1_TO_WATCH )                                   \
-        printk("get_page_type(%x) c=%p ot=%p @ %s:%d in %s\n",                \
-               MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info,          \
-               frame_table[MFN1_TO_WATCH].u.inuse.type_info,                  \
-               __FILE__, __LINE__, __func__);                                 \
-    _get_page_type(_p, _t);                                                   \
-})
-#define put_page_type(__p) (                                                  \
-{                                                                             \
-    struct pfn_info *_p = (__p);                                              \
-    if ( page_to_pfn(_p) == MFN1_TO_WATCH )                                   \
-        printk("put_page_type(%x) c=%p ot=%p @ %s:%d in %s\n",                \
-               MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info,          \
-               frame_table[MFN1_TO_WATCH].u.inuse.type_info,                  \
-               __FILE__, __LINE__, __func__);                                 \
-    _put_page_type(_p);                                                       \
-})
-#else
-#define _get_page_type get_page_type
-#define _put_page_type put_page_type
-#endif
-
-void _put_page_type(struct pfn_info *page);
-int  _get_page_type(struct pfn_info *page, u32 type);
+void put_page_type(struct pfn_info *page);
+int  get_page_type(struct pfn_info *page, u32 type);
 int  get_page_from_l1e(l1_pgentry_t l1e, struct domain *d);
 void put_page_from_l1e(l1_pgentry_t l1e, struct domain *d);
 
index ce6198aed95316b04c0e6a029917dd74a53544b6..e2f1e4f8b9504d2c4f7f7964e036c4a1bd7785b8 100644 (file)
@@ -2,6 +2,7 @@
  * include/asm-x86/shadow.h
  * 
  * Copyright (c) 2005 Michael A Fetterman
+ * Based on an earlier implementation by Ian Pratt et al
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index f86b022d9a5a9ee648f63d8a0e7a49898f97e1b4..d8cdf0b74e535850910b37c0f3037f487971ba11 100644 (file)
 extern unsigned long *mapcache;
 #define MAPCACHE_ENTRIES        1024
 
-
-//#define WATCH_MAP_DOMAIN_CALLERS 1
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-extern int map_domain_mem_noisy;
-#define map_domain_mem(__mdm_pa) (                                            \
-{                                                                             \
-    unsigned long _mdm_pa = (__mdm_pa);                                       \
-    if ( map_domain_mem_noisy )                                               \
-        printk("map_domain_mem(%p) @ %s:%d in %s\n",                          \
-               _mdm_pa, __FILE__, __LINE__, __func__);                        \
-    _map_domain_mem(_mdm_pa);                                                 \
-})
-#else
-#define _map_domain_mem map_domain_mem
-#endif
-
 /*
  * Maps a given physical address, returning corresponding virtual address.
  * The entire page containing that VA is now accessible until a 
  * corresponding call to unmap_domain_mem().
  */
-extern void *_map_domain_mem(unsigned long pa);
+extern void *map_domain_mem(unsigned long pa);
 
 /*
  * Pass a VA within a page previously mapped with map_domain_mem().